import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2025-03-13
 * Time: 22:27
 */
public class test1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n=scanner.nextInt();
        int[][] arr=new int[n][3];
        for(int i=0;i<n;i++) {
            for (int j = 0; j < 3; j++) {
                arr[i][j] = scanner.nextInt();
            }
        }
        int[] sum=new int[n];
        for(int i=0;i<n;i++) {
            int min=Math.min(arr[i][0],Math.min(arr[i][1],arr[i][2]));
            if(min==arr[i][1]){
                sum[i]=min*2;
            }
            else {
                sum[i]=min*2+(arr[i][1]-min-1);
            }

        }
        for(int i=0;i<n;i++) {
            System.out.println(sum[i]);
        }

    }
}
